<template>
  <el-row v-loading="loading">
    <el-image v-if="url" :src="url"/>
  </el-row>
</template>

<script>
import expoApi from "@/api/expo.js";
import {useRoute} from "vue-router";

export default {
  name: "index",
  data() {
    return {
      queryParam: {
        id: "",
      },
      loading: false,
      url: ""
    }
  },
  created() {
    let query = useRoute().query;
    if (query.id) {
      this.queryParam.id = query.id
      this.loadInfo()
    }
  },
  methods: {
    loadInfo() {
      this.loading = true
      expoApi.show(this.queryParam).then(({data}) => {
        this.loading = false
        if (data) {
          if (data.file) {
            return this.url = `https://erp.aihehao.com/uploads/${data.file}`;
          }
          if (data.rfile2) {
            return this.url = `https://oa.aihehao.com/uploads/${data.rfile2}`;
          }
        }
      })
    },
  }
}
</script>

<style scoped>

</style>